<?php

/**
 * This is the main entrypoint of the application. This is the default controller called
 * when a user accesses the site.
 */
	class Start extends Controller {
		
		function start()
		{
			parent::Controller();
		}

		function index()
		{
			$data['mysite'] = "My Site";
			$data['base'] = $this->config->item('base_url');
			$data['css'] = $this->config->item('css');
			$data['mytitle'] = "My first CI website";
			$data['text'] = "Please log in here!";
			
			$this->load->view('entrypage_view', $data);
		}
		
		function mainpage()
		{
			$this->load->view('main_menu_view');
			// echo redirect('customers');
		}
	
		// Receives the username and password from the entrypage view via the POST array
		// Calls the function checkme to authorize the user/password
		// If valid user, calls the mainpage method, else it re-displays the index
		function assessme()
		{
			$username = $_POST['username'];
			$password = $_POST['password'];
			
			if ($this->checkme($username, $password) == 'yes')
			{
				$this->mainpage();
			}
			else
			{
				$this->index();
			}
		}
		
		function checkme($username='', $password='')
		{
			if ($username == 'julio')
				return 'yes';
		}
	}